from google.appengine.ext import webapp, db
from google.appengine.ext.webapp import util
import json

class Score(db.Model):
    points = db.IntegerProperty()

class MainHandler(webapp.RequestHandler):
    def get(self):
        self.response.out.write(json.dumps([score.points for score in Score.all()]))
    def post(self):
        points = int(self.request.get('points'))
        Score(points = points).put()

application = webapp.WSGIApplication([('/score', MainHandler)],
                                     debug=True)

def main():
    util.run_wsgi_app(application)


if __name__ == '__main__':
    main()
